<?php

namespace app\common\model\marketing;

use addons\xyb\XypHelper;
use think\Model;


class AssociationProgress extends Model
{

    // 表名
    protected $name = 'association_progress';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;


    public static function getUsersAssociationProgressTotal($user_id, $association_id, $association_key = '', $trends_type = 'image'){
        return AssociationProgress::where('user_id', $user_id)
            ->where('association_id', $association_id)
            ->where('grant_status', 1)
            ->where('association_key', $association_key)
            ->where('trends_type', $trends_type)
            ->count();

    }
}